import axios from "axios";

export const getTeamListInfo = async (pToken: string) => {
    const url = "https://pocketapi.48.cn/im/api/v1/im/team/tab/list";
    const config = {
      method: "post",
      maxBodyLength: Infinity,
      url: url,
      headers: {
        host: "pocketapi.48.cn",
        "content-type": "application/json;charset=utf-8",
        appinfo:
          '{"vendor":"apple","deviceId":"D6193A0F-656F-4D8A-AB0C-005B9339FA08","appVersion":"7.1.18","appBuild":"24111001","osVersion":"16.2.0","osType":"ios","deviceName":"iPhone 14","os":"ios"}',
        accept: "*/*",
        pa: "MTczNDI3ODU1MTAwMCwzNzY0LDRGQ0I0MDBEMzhDOEI5MkEwREQ4N0FFNEI5MkQzQTk0LA==",
        "accept-language": "zh-Hans-CN;q=1",
        "p-sign-type": "V0",
        token: pToken,
        "user-agent": "PocketFans201807/7.1.18 (iPhone; iOS 16.2; Scale/3.00)",
      },
      data: { groupId: 0, typeId: 0, ctime: 0, limit: 20 },
    };
    try {
      const res = await axios.request(config);
      if (res.data.content) return res.data.content;
      return false;
    } catch (error) {
      return false;
    }
  };